package ar.edu.unq.auxiliar.domain;

import java.io.Serializable;
import java.util.ArrayList;

import org.apache.wicket.Page;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.markup.repeater.data.ListDataProvider;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

public class Sub1Page extends WebPage {

    public Sub1Page() {
        
        Contact contact = null;
        ArrayList list = new ArrayList();

        char character;
        
        // a - z
        for (int i = 97; i < 123; i++) {
            character = (char) i;
            contact = new Contact(String.valueOf(character));
            list.add(contact);
        }
        
        final DataView dataView = new DataView("simple", new ListDataProvider(
                list)) {
            public void populateItem(final Item item) {
                final Contact user = (Contact) item.getModelObject();
                item.add(new Label("id", user.getId()));
            }
        };

         dataView.setItemsPerPage(10);
        
        add(dataView);

        add(new PagingNavigator("navigator", dataView));
    }

}

class Contact implements Serializable {

    private final String id;

    public Contact(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

}